import os, os.path;

# fiilelist
cpp_list = Split("""
	main.cpp
""");

# directories
lib_name = 'bs';
tar_name = 'bspy_loader';

# import custom settings
Import('*');

# construct base environ
base_env = custom_env.Clone();
base_env.AppendUnique(
	CPPDEFINES = ['BS_EXPORTING_PLUGIN', 'TARGET_NAME=bs'],
	CPPPATH = ['src', '#kernel/include', '#kernel/include/python'],
);
# remove any lib prefix
base_env['SHLIBPREFIX'] = '';

if build_kind == 'debug' :
	base_env.AppendUnique(
		CPPDEFINES = ['_DEBUG'],
		LIBS = ['blue_sky_d']);
	#if base_env['platform'].startswith('lin') :
	#	base_env.Append(LIBS = ['boost_python-mt-d']);
else :
	base_env.AppendUnique(
		LIBS = ['blue_sky']);
	#if base_env['platform'].startswith('lin') :
	#	base_env.Append(LIBS = ['boost_python-mt']);

# actually build target
bspy_loader = base_env.SharedLibrary(target = os.path.join(tar_exe_dir, lib_name), source = [os.path.join('src', x) for x in cpp_list]);

# do we ignore dependencies?
if base_env['deps'] == 'off' :
	Ignore(bspy_loader, bs_kernel);
elif base_env['deps'] == 'explicit' :
	Depends(bspy_loader, bs_kernel);
base_env.Alias(tar_name, bspy_loader);
Export('bspy_loader');

# 	Install step
if base_env['install'] == '1':
	inst_tar = base_env.Install('$prefix', bspy_loader);
	Alias(tar_name, inst_tar);

